-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Git repos with multiple remotes configured #1782
Add support for Git repos with multiple remotes configured #1782
Conversation
d1985d2
to
a207905
Compare
6441345
to
77992da
Compare
This one is ready for review too, @mosteo. You can ignore my previous (deleted) comment. |
77992da
to
6a29f1c
Compare
Conflicts in: - src/alire/alire-publish.ads
def commit_file(commit_name: str, path: str, content: str): | ||
""" | ||
Create a new file with the specified content and `git commit` it. | ||
|
||
Also returns the commit's hash and attaches the tag `f"tag_{commit_name}"` | ||
thereto. | ||
""" | ||
with open(path, "x") as f: | ||
f.write(content) | ||
run(["git", "add", path]) | ||
run(["git", "commit", "-m", f"Commit {commit_name}"]) | ||
run(["git", "tag", f"tag_{commit_name}"]) | ||
return git_head() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in helpers.py named as git_commit_file
, for general availability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor refactor.
I'm assuming this is transient. |
Yes it is. |
Merged, thanks. |
A Git repo may have multiple remotes configured, often with different branches tracking different remotes. For example, development may be done on a private repository, with release/production versions available on a public repository.
Currently Alire assumes there is at most one remote, and therefore ends up using whichever is first alphabetically when there is more than one. In practice, this is only relevant to
alr publish
ing, since dependencies are always fetched as a plaingit clone
, which does indeed yield a repo with only one remote.This PR makes this assumption more explicit where applicable, and adds a subprogram to
Alire.Publish.Local_Repository
which attempts to guess the appropriate remote when there is more than one.